[IA64] shrink ia64 struct page_info.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Fri, 13 Feb 2009 02:23:16 +0000 (11:23 +0900)
committerIsaku Yamahata <yamahata@valinux.co.jp>
Fri, 13 Feb 2009 02:23:16 +0000 (11:23 +0900)
This patch is the ia64 counter part of 19107:0858f961c77a,
19132:5848b49b74fc and 19136:162cdb596b9a.
This patch shrink ia64 struct page_info and rearrange its members.

The shrinking is made compile time option in config.h with default off
becuase physical address size is architected to 50bit by ia64
and mfn isn't always addressed by 32bits with 16KB page size.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/arch/ia64/Rules.mk
xen/arch/ia64/xen/domain.c
xen/include/asm-ia64/mm.h

index 3109a0a37e1a9e75f0c49fba5ebcdbfa62f577c3..bef11c3196293982a6d1ecb137b388b58bcc12ea 100644 (file)
@@ -16,6 +16,13 @@ xen_ia64_tlb_track_cnt       ?= n
 xen_ia64_tlbflush_clock        ?= y
 xen_ia64_disable_optvfault ?= n
 
+# If they are enabled,
+# shrink struct page_info assuming all mfn can be addressed by 32 bits.
+# However, with 50bit ia64 architected physical address and 16KB page size,
+# mfn isn't always assessed by 32bit. So they are disabled by default.
+xen_ia64_shrink_page_list ?= n
+xen_ia64_pickle_domain ?= n
+
 # Used only by linux/Makefile.
 AFLAGS_KERNEL  += -mconstant-gp -nostdinc $(CPPFLAGS)
 
@@ -71,5 +78,11 @@ endif
 ifeq ($(xen_ia64_disable_optvfault),y)
 CFLAGS += -DCONFIG_XEN_IA64_DISABLE_OPTVFAULT
 endif
+ifeq ($(xen_ia64_shrink_page_list),y)
+CFLAGS += -DCONFIG_IA64_SHRINK_PAGE_LIST
+endif
+ifeq ($(xen_ia64_pickle_domain),y)
+CFLAGS += -DCONFIG_IA64_PICKLE_DOMAIN
+endif
 
 LDFLAGS = -g
index 2cf4a556669785c5c4ae1f7c9c28b5896bf5b090..2b6ab31d125e63046cff29d21fc61823f277fb1d 100644 (file)
@@ -407,12 +407,29 @@ void relinquish_vcpu_resources(struct vcpu *v)
 
 struct domain *alloc_domain_struct(void)
 {
-    return xmalloc(struct domain);
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+       struct domain *d;
+       /*
+        * We pack the MFN of the domain structure into a 32-bit field within
+        * the page_info structure. Hence the MEMF_bits() restriction.
+        */
+       d = alloc_xenheap_pages(get_order_from_bytes(sizeof(*d)),
+                               MEMF_bits(32 + PAGE_SHIFT));
+       if ( d != NULL )
+               memset(d, 0, sizeof(*d));
+       return d;
+#else
+       return xmalloc(struct domain);
+#endif
 }
 
 void free_domain_struct(struct domain *d)
 {
-    xfree(d);
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+       free_xenheap_pages(d, get_order_from_bytes(sizeof(*d)));
+#else
+       xfree(d);
+#endif
 }
 
 struct vcpu *alloc_vcpu_struct(void)
index afd65d61ff7b6c63a05488212c7cad0fbc36b4fc..1568786ea68c903d1e1edf84fea8e6314d52597a 100644 (file)
@@ -39,19 +39,26 @@ typedef unsigned long page_flags_t;
 
 #define PRtype_info "016lx"
 
-#if 0
+#ifdef CONFIG_IA64_SHRINK_PAGE_LIST
 /*
  * See include/xen/mm.h.
- * For now, abandon to compress struct page_info
- * seeing IA64_MAX_PHYS_BITS and page size.
+ * To compress page_list_entry, all the physical address must
+ * be addressed by (32 + PAGE_SHIFT) .
+ * However this is lower than IA64_MAX_PHYS_BITS = 50.
  */
 #undef page_list_entry
 struct page_list_entry
 {
-    unsigned long next, prev;
+    u32 next, prev;
 };
 #endif
 
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+typedef u32 __ia64_domain_t;
+#else
+typedef unsigned long __ia64_domain_t;
+#endif
+
 struct page_info
 {
     /* Each frame can be threaded onto a doubly-linked list. */
@@ -65,10 +72,10 @@ struct page_info
 
         /* Page is in use: ((count_info & PGC_count_mask) != 0). */
         struct {
-            /* Owner of this page (NULL if page is anonymous). */
-            unsigned long _domain; /* pickled format */
             /* Type reference count and various PGT_xxx flags and fields. */
             unsigned long type_info;
+            /* Owner of this page (NULL if page is anonymous). */
+            __ia64_domain_t _domain; /* pickled format */
         } inuse;
 
         /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
@@ -132,8 +139,16 @@ struct page_info
 #define is_xen_heap_mfn(mfn)    (mfn_valid(mfn) &&                      \
                                  is_xen_heap_page(mfn_to_page(mfn)))
 
+#ifdef CONFIG_IA64_PICKLE_DOMAIN
+#define page_get_owner(_p)                                              \
+    ((struct domain *)((_p)->v.inuse._domain ?                          \
+                       mfn_to_virt((_p)->v.inuse._domain) : NULL))
+#define page_set_owner(_p,_d)                                           \
+    ((_p)->v.inuse._domain = (_d) ? virt_to_mfn(_d) : 0)
+#else
 #define page_get_owner(_p)      ((struct domain *)(_p)->u.inuse._domain)
 #define page_set_owner(_p, _d) ((_p)->u.inuse._domain = (unsigned long)(_d))
+#endif
 
 #define XENSHARE_writable 0
 #define XENSHARE_readonly 1